package Map
{
	import flash.display.DisplayObjectContainer;
	import flash.display.Shape;
	import flash.display.Sprite;
	
	public class CMapTile
	{
		public static const TILE_WIDTH	:uint	= 20;
		public static const TILE_HEIGHT	:uint	= 20;
		
		public static const TYPE_NORMAL :uint	= 0;
		public static const TYPE_BLOCK :uint	= 1;
		public static const TYPE_DOOR :uint		= 2;
		public static const TYPE_GOAL :uint		= 3;
		
		public static const ATT_ITEM :uint		= 0;
		public static const ATT_COUNT :uint		= 1;
		
		private var m_nType :uint;
		
		private var m_arrAttribute :Array;
		
		protected var m_nColIndex :int;
		protected var m_nRowIndex :int;
		protected var m_sprite :Sprite;
		
		public function get nType() :uint { return m_nType; }
		
		public function CMapTile(nType :uint, nColIndex :int, nRowIndex :int)
		{
			m_nType = nType;
			
			m_nColIndex = nColIndex;
			m_nRowIndex = nRowIndex;
			
			m_arrAttribute = new Array();
			for (var i:uint = 0; i < ATT_COUNT; ++i)
			{
				m_arrAttribute.push(false);
			}
		}
		public function GetAttribute(nAttID :uint) :Boolean
		{
			return m_arrAttribute[nAttID];
		}
		public function SetAttribute(nAttID :uint, bIs :Boolean) :void
		{
			if (nAttID >= m_arrAttribute.length) return;
			m_arrAttribute[nAttID] = bIs;
		}
		public function AddToParent(refParent :DisplayObjectContainer) :void
		{
			refParent.addChild(m_sprite);
		}
		public function RemoveFromParent(refParent :DisplayObjectContainer) :void
		{
			refParent.removeChild(m_sprite);
		}
	}
}